/**
 * 
 */
package com.zhmy.xmgl;

import java.util.Map;

import org.gocom.components.coframe.rights.dataset.CapUser;
import org.gocom.components.coframe.rights.user.CapUserService;
import org.gocom.components.coframe.tools.CoframeDASDaoSupport;

import com.eos.das.entity.ExpressionHelper;
import com.eos.das.entity.IDASCriteria;
import com.eos.data.datacontext.DataContextManager;
import com.eos.data.datacontext.IMUODataContext;
import com.eos.data.datacontext.IUserObject;
import com.eos.data.datacontext.UserObject;
import com.eos.system.annotation.Bizlet;

/**
 * @author wl
 * @date 2018-03-28 19:49:53
 *
 */
@Bizlet("")
public class CapUsers extends CoframeDASDaoSupport{
	
	@Bizlet("获取当前用户OperatorId")
	public String getUserOperatorId()
	{
		String userId = getUserUserId();
		
		IDASCriteria dasCriteria = getDASTemplate().createCriteria(CapUser.QNAME);
		dasCriteria.add(ExpressionHelper.eq("userId", userId));
		CapUser[] users = getDASTemplate().queryEntitiesByCriteriaEntity(CapUser.class, dasCriteria);
		String operatorId = users.length > 0 ? users[0].getString("operatorId") : "";
		return operatorId;
	}
	

	@Bizlet("获取当前用户UserId")
	public String getUserUserId()
	{
		IMUODataContext muo = DataContextManager.current().getMUODataContext();
		IUserObject userobject = muo.getUserObject();
		return userobject.getUserId();
	}
	
}
